<?php
namespace app\manage\controller;
use think\Db;
use think\Exception\PDOException;
class affairTest extends AffairBase{
	protected $step = 3;
	function __construct() {
		parent::__construct();
	}
	
	public function affairApplyInit($affair_info_id, $uid=2) {
		$res = Db::table('affair_info')->field('name,step,info')->find($affair_info_id);
		if(!$res) return ['state' =>　0, 'msg' => '没找到该种事务'];
		$res['cur_step'] = 1;
		$save = [
				'uid' => $uid,
				'affair_num' => $affair_info_id.'_'.$uid.'_'.time().rand(100000, 9999),
				'type' => $affair_info_id,
				'info' => json_encode($res),
				'state' => 0,
				'cur_step' => 1,
				];
		try{
			$res = Db::table('affair_flow')->insertGetId($save);
		} catch(PDOException $e){
			return ['state' => 0, 'msg' => '操作失败,请重试!'];
		}
			return ['state' => 1, 'data' => $res];{
		}
	}
	public function affairProcess($affair_flow_id) {
		$res = Db::table('affair_flow')->find($affair_flow_id);
	}
	
	public function getAffairInfo() {}
	
	
	public function affairStep1Init() {}
	
	public function affairStep1Pass() {}
	
	public function affairStep2Init() {}
	
	public function affairStep2Pass() {}
	
	public function affairStep3Init() {}
	
	public function affairStep3Pass() {}
	
}

?>